<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>鼓励金兑现</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="../css/style.css"/>
		<link rel="stylesheet" href="../css/iconfont.css" />
		<link rel="stylesheet" href="../css/wallet.css" />
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" href="JavaScript:history.go(-1)"></a>
		    <h1 class="mui-title">鼓励金兑现</h1>
		</header>
		<div class="mui-content yongj_content">
			<div class="exchange_top">
				<div class="exchange_tnr"><em id="store_name"></em></div>
			</div>
		    <div class="exchange_lisbox">
		    	<ul class="mui-table-view mui-grid-view mui-grid-9 eul clearfix">
		    		<li>
		    			<div data-value="100" class=" eli">
		    				<p>100元</p>
		    				<p class="sxjif">1000鼓励金</p>
		    			</div>
		    		</li>
		    		<li>
		    			<div data-value="200" class=" eli">
		    				<p>200元</p>
		    				<p class="sxjif">2000鼓励金</p>
		    			</div>
		    		</li>
		    		<li>
		    			<div data-value="500" class=" eli">
		    				<p>500元</p>
		    				<p class="sxjif">5000鼓励金</p>
		    			</div>
		    		</li>
		    		<li>
		    			<div data-value="1000" class=" eli">
		    				<p>1000元</p>
		    				<p class="sxjif">10000鼓励金</p>
		    			</div>
		    		</li>
		    		<li>
		    			<div data-value="2000" class=" eli">
		    				<p>2000元</p>
		    				<p class="sxjif">20000鼓励金</p>
		    			</div>
		    		</li>
		    		<li>
		    			<div data-value="5000" class=" eli">
		    				<p>5000元</p>
		    				<p class="sxjif">50000鼓励金</p>
		    			</div>
		    		</li>
		    	</ul>
		    </div>
		    <div class="wallet_btn" id='quren'><lable style='color: #fff;'>确认兑现</lable></div>
		    <div class="exchange_tip">
		    	<div class="exchange_bt"><span>温馨提示</span></div>
		    	<p>1000鼓励金可兑换100元，10鼓励金=1元人民币，1000鼓励金起兑，未满1000鼓励金不可兑现</p>
		    </div>
		</div>
		<input type="hidden" id="value" />
	</body>

</html>
<script src="js/mui.min.js"></script>

<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/layer/layer.min.js"></script>
<script type="text/javascript" src="../js/app.js"></script>

<script>
	$(".eli").click(function(){
		$(".eul").find(".active").removeClass("active");
		$(this).addClass("active");
		$("#value").val($(this).data("value"));
	})
		$.ajax({
				url: APP.api_url + 'agent/get_agent',
				data: {
						store_id	: getUrlParam('store_id')
				},
				success: function(data) {
					$('#store_name').text(data.agent.store_name);
				}
			})
			
		$("#quren").click(function(){
			var value=$("#value").val();
			if($("#value").val()==""){
				layer.msg("请选择兑换金额");
				return ;
			}
				
			$.ajax({
				url: APP.api_url + 'Wallet/exchange',
				data: {
						token	: "cheshi",
						session_id	: getUrlParam('sid'),
						store_id	: getUrlParam('store_id'),
						value	: value
				},
				success: function(data) {
					if(data.code == 200) {
						jump(data.msg,"../index.html");

					} else {
						layer.msg(data.msg);
						console.log(data.msg);
					}
				}
			})
		})
</script>